#include<bits/stdc++.h>

using namespace std;
int a[5];
int n = 5;

int main() {
    for (int i = 0; i < n; i++)cin >> a[i];
    sort(a, a + 5);
    int best = INT_MAX;
    do {
        if (a[0] == 0 || a[3] == 0)continue;
        int cur = (a[0] * 100 + a[1] * 10 + a[2]) * (a[3] * 10 + a[4]);
        best = min(cur, best);
    } while (next_permutation(a, a + n));
    cout << best << endl;
    return 0;

}
